package com.androidjam.runningacoruna;

import java.util.ArrayList;
import java.util.List;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.OverlayItem;
import android.content.res.Resources;

public class Track extends OverlayItem{
	
	private String name;	
	private String description;
	private List<GeoPoint> points;
	private TYPE type;	
	private int estimatedTime;
	private float distance;
	private int elevation;
	private int heart_rythm;
	private int calories;
	
	public static enum TYPE {
		RUNNING_EASY, RUNNING_MEDIUM, RUNNING_HARD, RUNNING_IRONMAN;
	}
	
	public static String getTypeString(TYPE type){
		switch(type){
		case RUNNING_EASY: return MainActivity.resources.getString(R.string.type_string_easy);				
		case RUNNING_MEDIUM: return MainActivity.resources.getString(R.string.type_string_medium);
		case RUNNING_HARD: return MainActivity.resources.getString(R.string.type_string_hard);
		case RUNNING_IRONMAN: return MainActivity.resources.getString(R.string.type_string_ironman);	
		default: return "";
		}		
	}
	
	
	public Track (String name, GeoPoint p, String desc, TYPE type){
		super(p, name, "Snippet Text");
		this.name = name;		
		this.description = desc;
		this.points = new ArrayList<GeoPoint>();
		this.type = type;	
		this.estimatedTime = 0;
		this.distance = 0;
		this.elevation = 0;
		this.heart_rythm = 0;
		this.calories = 0;
	}
	
	public String getUrl() {
		
		return "http://estaurl.com";
	}	
	
	
	public void generateSamplePoints(){		
		for(int i=0;i<10;i++){
			if(i%2==0){
				int lat = (int) ((this.getPoint().getLatitudeE6()-2000*i-2*type.ordinal()) );
				int lng = (int) ((this.getPoint().getLongitudeE6()-2000*i-1000*type.ordinal()) );
				this.points.add(new GeoPoint(lat,lng));
			}
			else{
				int lat = (int) ((this.getPoint().getLatitudeE6()-2000*i-2*type.ordinal()));
				int lng = (int) ((this.getPoint().getLongitudeE6()+3000*i+2000*type.ordinal()));
				this.points.add(new GeoPoint(lat,lng));
			}			
		}	
	}
	
	public List<GeoPoint> getGeoPoints(){
		return this.points;
	}
	
	public TYPE getType() {
		return type;
	}

	public void setType(TYPE type) {
		this.type = type;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public int getEstimatedTime() {
		return estimatedTime;
	}

	public void setEstimatedTime(int stimatedTime) {
		this.estimatedTime = stimatedTime;
	}

	public float getDistance() {
		return distance;
	}

	public void setDistance(float distance) {
		this.distance = distance;
	}

	public int getElevation() {
		return elevation;
	}

	public void setElevation(int elevation) {
		this.elevation = elevation;
	}

	public int getHeart_rythm() {
		return heart_rythm;
	}

	public void setHeart_rythm(int heart_rythm) {
		this.heart_rythm = heart_rythm;
	}

	public int getCalories() {
		return calories;
	}

	public void setCalories(int calories) {
		this.calories = calories;
	}

}
